<template>
  <div id="newinfo">
    <h3 class="title">{{newinfo.title}}</h3>
    <p class="subtitle">
      <span>发表时间：{{newinfo.add_time | myFilter}}</span>
      <span>点击{{newinfo.click}}次</span>
    </p>
    <hr>
    <div class="connent" v-html="newinfo.content"></div>
    <coment :id="this.id"></coment>
  </div>
</template>

<script>
import coment from './subcomponents/coment'
export default {
  data() {
    return {
      id: this.$route.params.id,
      newinfo:{}
    };
  },
  methods: {
    getdata() {
      this.$axios.get("/api/getnew/" + this.id).then(res => {
          this.newinfo=res.data.message[0]
        console.log(this.newinfo);
      });
    }
  },
  components:{
      coment
  },
  created() {
    this.getdata();
  }
};
</script>

<style scoped lang="scss">
#newinfo{
    padding: 0 4px;
    .title{
        font-size: 16px;
        color: red;
        text-align: center;
        margin: 15px 0;
    }
    .subtitle{
        display: flex;
        justify-content: space-between;
        font-size: 15px;
        color: rgb(22, 93, 141);
    }
}
</style>
